package com.hq.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hq.service.impl.ConverImpl;
import com.hq.utils.JSONObjectUtil;

/**
 * Servlet implementation class ConverObtainServlet
 */
@WebServlet("/ConverObtainServlet")
public class ConverObtainServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String conver_id = request.getParameter("conver_id");
		PrintWriter print = response.getWriter();
		if(conver_id == null) {
			print.print(JSONObjectUtil.createLoginPushMoreConver(new ConverImpl().pushMoreConver(0,5,null)));
		}else {
			print.print(JSONObjectUtil.createLoginPushMoreConver(new ConverImpl().pushMoreConver(0,5,Integer.valueOf(conver_id))));	
		}
		print.close();
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
